/**
 * 1。Promise是一个类，在执行的时候需要传一个执行器进去，执行器立即调用
 * 2.Promise有三种状态  成功fulfilled  失败rejected 等待pending
 *     pending ==> fulfilled
 *     pending ==> reject 
 *     状态一旦确定就不可更改
 * 3.resolve和reject函数式用来更改状态的
 *     resolve: fulfilled
 *     reject: rejected
 */
const MyPromise = require("./MyPromise.js");
const mypromise = new MyPromise((resolve,reject)=>{
  setTimeout(() => {
    resolve("成功setTimeout");
  }, 2000);
  // reject("失败")
});

mypromise.then((value)=>{
  console.log(value)
},(reason)=>{
  console.log(reason)
})
mypromise.then((value)=>{
  console.log(value)
},(reason)=>{
  console.log(reason)
})
mypromise.then((value)=>{
  console.log(value)
},(reason)=>{
  console.log(reason)
})